<template>
  <div>
    <van-nav-bar
      title="个性签名"
      right-text="完成"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <van-cell-group>
      <van-field  v-model="value"  placeholder="请完成填写个性签名~" />
    </van-cell-group>
  </div>
</template>
<script>
import Vue from "vue";
import { NavBar } from "vant";
import { Toast, Field } from "vant";
Vue.use(Field);
Vue.use(NavBar);
export default {
  name: "autograph",
   data() {
    return {
      value: null,
    };
  },
  mounted() {
    this.userId= localStorage.getItem("userId")

  },
  methods: {
    onClickLeft() {
       this.$router.go(-1)
    },
    onClickRight() {
      Toast("按钮");
      this.axios({
        url:"http://localhost:3000/signature",
        method:'post',
        data:{
            data:this.value,
            userId:this.userId
        }
      }).then((res)=>{
        console.log(res.data)
        if(res.data=="不能为空"){
          Toast("不能为空")
        }else{
        const data = JSON.parse(res.config.data).data
        // this.value=data
        this.$router.push({path:"compilation",query:{value:data}})
        }
        
      } , (err)=>{
        console.log("099999")
        console.log(err)
      })
     
    },
  },
};
</script>
<style scoped>
.van-cell__value span{
  overflow: hidden;
}
/deep/.van-nav-bar__text {
  color: black;
}
/deep/.van-icon {
  color: black;
}
</style>